#ifndef __ANIMATION_INFO_H__
#define __ANIMATION_INFO_H__

#include "Packet.h"



class LinearFunction
{
public:
	std::vector<_POSITION> vecPos;

	LinearFunction(const std::vector<_POSITION>& vecPos)
	{
		ACE_ASSERT(vecPos.size() >= 2);

		this->vecPos = vecPos;
	}

	~LinearFunction()
	{
		vecPos.clear();
	}

	double GetY(double x);
};



class AnimationInfo
{
private:

	_OBJ_INFO init_info;

	int frame_count;
	_OBJ_INFO *frame_list; 


	bool CalcAlpha( Json::Value & alpha_info);
	bool CalcTransform( Json::Value & trans_info);

public:

	
	AnimationInfo(_OBJ_INFO & init_info)
	{
		this->init_info = init_info;

		frame_count = init_info.GetTime().GetDuration() * ((double)Settings::GetSettings()->FRAME_RATE);
		if(frame_count > 0)
			frame_list = new _OBJ_INFO[frame_count];
		else
			frame_list = NULL;

		for(int i = 0 ; i < frame_count ; i ++)
		{
			frame_list[i] = init_info;
		}
	}

	~AnimationInfo()
	{

		if(frame_list)
			delete[] frame_list;
	}

	int GetFrameCount()
	{
		return frame_count;
	}

	_OBJ_INFO * GetFrameList()
	{
		return frame_list;
	}

	bool CalcAnimation(Json::Value & animation_info);


};

#endif
